package cn.edu.sdjzu.xg.eagle.entity;

import lombok.NoArgsConstructor;
import lombok.ToString;

import java.io.Serializable;

/**
 * @author tg.si@188.com
 * @project xg22
 * @date 2024/3/26
 */

@ToString
@NoArgsConstructor
public class Department implements Comparable<Department>, Serializable {
    private Integer id;
    private String description;
    private String no;
    private String remarks;
    private School school;

    // 构造函数：仅传入id和description
    public Department(Integer id, String description) {
        this(null, description, null, null); // 调用通用构造函数
        this.id = id;
    }

    // 构造函数：包含description、no、remarks和school
    public Department(String description, String no, String remarks, School school) {
        this(description, no, remarks); // 调用更简单的构造函数
        this.school = school;
    }

    // 构造函数：包含description、no和remarks
    public Department(String description, String no, String remarks) {
        this.description = description;
        this.no = no;
        this.remarks = remarks;
    }

    public Integer getId() {
        return id;
    }

    public String getDescription() {
        return description;
    }

    public String getNo() {
        return no;
    }

    public String getRemarks() {
        return remarks;
    }

    public School getSchool() {
        return school;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public void setNo(String no) {
        this.no = no;
    }

    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }

    public void setSchool(School school) {
        this.school = school;
    }

    /**
     * 编号排序
     * @param o the object to be compared.
     * @return
     */
    @Override
    public int compareTo(Department o) {
        if (o == null || o.no == null) {
            throw new IllegalArgumentException("Comparison object or its 'no' field is null.");
        }
        return (this.no == null) ? -1 : this.no.compareTo(o.no);
    }
}


